﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace calendar
{
    class Program
    {
        static void Main(string[] args)
        {

            Calendar ca = new Calendar();       //新建日历
            CalendarException exp = new CalendarException();

            exp.DayWorking = 1;
            exp.StartDate = new DateTime(2013, 1, 5);
            exp.EndDate = new DateTime(2013, 1, 7);
            //DateRange dr1 = new DateRange(DateTime.Parse("0001-01-01T08:00:00"), DateTime.Parse("0001-01-01T12:00:00"));
            //DateRange dr2 = new DateRange(DateTime.Parse("0001-01-01T13:00:00"), DateTime.Parse("0001-01-01T17:00:00"));
            DateRange dr3 = new DateRange(DateTime.Parse("0001-01-01T18:00:00"), DateTime.Parse("0001-01-01T21:00:00"));
            //exp.AddWorkingTime(dr1);
            //exp.AddWorkingTime(dr2);
            exp.AddWorkingTime(dr3);

            
            ca.AddException(exp);
            

            long dur = ca.GetDuration(new DateTime(2013, 1, 4, 08, 30, 00), new DateTime(2013, 1, 5, 19, 0, 0));

            double res = util.Ticks2Hour(dur);

            // 测试 IROT
            DateRange dr = new DateRange(new DateTime(2013, 1, 9, 08, 30, 00), new DateTime(2013, 1, 9, 12, 00, 00));
            DateTime it = new DateTime(2013, 1, 9, 13, 00, 00);
            double tmp = util.Ticks2Hour(dr.InRangeOfTicks(it.Ticks));

            ProjectCalendarException pce2 = new ProjectCalendarException(new DateTime(2013, 1, 9, 08, 30, 00), new DateTime(2013, 1, 9, 12, 00, 00));
        }
    }
}
